// @description 公用API
// @author yurui
// @createDate 2020.10.22
// @version v1.0.0
import { defHttp } from '/@/utils/http/axios';
import { ApiCommon } from '../common';

const {
  ADMIN_USER_DICT_API,
  SYS_ADMIN_API,
  METER_ADMIN_DICT_API,
  BILLING_ADMIN_API,
  CUSTOMER_METER_API,
  ALTIMETER
} = ApiCommon;
const ADMIN_USER_REGION_DICT_API = `${ADMIN_USER_DICT_API}/region`;
const DEPT_TREE_API = `${SYS_ADMIN_API}/dept`;
const SEWAGE_AREA_DICT_API = `${ADMIN_USER_DICT_API}/sewage-area`;
const SEWAGE_PLANT_DICT_API = `${ADMIN_USER_DICT_API}/sewage-plant`;
const ADMIN_USER_DICT_PARAMS = `${ADMIN_USER_DICT_API}/params`;
const ADMIN_CONTACT_DICT_API = `${ADMIN_USER_DICT_API}/contact`;
const MANAGELIST_API = `${CUSTOMER_METER_API}/reading/book`;

enum Api {
  LIST = '/list', //省市区联动对应表 | 获取表册通用
  DEPT_TREE = '/tree', //获取当前用户所属部门-树形图
  KEY = '/', //获取公用类接口--男女/证件/行业分类/用水类别
  TYPE_PARAMS = '/type/params', //查询联系人身份
  USAGE_GET_ALL = '/usage/get/all', //全部水表用途
  FACTORY_METER_MODULE = '/factory-meter-module/all/selector', //厂家筛选接口
  FACTORY_METER_MODULE_GET_LIST = '/factory-meter-module/get/list', //查询厂商下的所有型号
  WATER_USAGE = '/water-usage/get/selector', //用水类别
  DIAMETER_LIST = '/diameter/list', //口径列表
  UNIT_PRICE = '/scheme/get/billing/unit-price', //获取计费单价数据
  ALT_CARD = 'card=idcard'//获取高拍仪---身份证
}

/**
 * @description: 请求的API地址
 */ //省市区联动对应表
export const regionListApi = (params: object) =>
  defHttp.get({ url: ADMIN_USER_REGION_DICT_API + Api.LIST, params });
//获取当前用户所属部门-树形图
export const deptTreeApi = () => defHttp.get({ url: DEPT_TREE_API + Api.DEPT_TREE });
//获取查询排污厂数据
export const sewageAreaApi = (params: object) =>
  defHttp.get({ url: SEWAGE_AREA_DICT_API + Api.LIST, params });
//获取查询净化厂数据
export const sewagePlantApi = () => defHttp.get({ url: SEWAGE_PLANT_DICT_API + Api.LIST });
//获取公用类接口
export const adminUserDictApi = (params: object) =>
  defHttp.get({ url: ADMIN_USER_DICT_PARAMS + Api.KEY + params.key });
//查询联系人身份
export const contactTypeParamsDictApi = (params: object) =>
  defHttp.get({ url: ADMIN_CONTACT_DICT_API + Api.TYPE_PARAMS, params });
//全部水表用途
export const usageGetAllApi = () => defHttp.get({ url: METER_ADMIN_DICT_API + Api.USAGE_GET_ALL });
//厂家筛选接口
export const factoryMeterAllApi = (params?: object) =>
  defHttp.get({ url: METER_ADMIN_DICT_API + Api.FACTORY_METER_MODULE, params });
//查询厂商下的所有型号
export const factoryMeterGetListApi = (params: object) =>
  defHttp.get({ url: METER_ADMIN_DICT_API + Api.FACTORY_METER_MODULE_GET_LIST, params });
//获取用水类别
export const waterUsageApi = () => defHttp.get({ url: BILLING_ADMIN_API + Api.WATER_USAGE });
//获取计费单价数据
export const unitPriceApi = () => defHttp.get({ url: BILLING_ADMIN_API + Api.UNIT_PRICE });
//获取表册列表
export const bookListApi = (params?: object) =>
  defHttp.get({ url: MANAGELIST_API + Api.LIST, params });
//获取口径列表
export const diameterListApi = () => defHttp.get({ url: METER_ADMIN_DICT_API + Api.DIAMETER_LIST });
//获取高拍仪--身份证
export const AltimeterCardApi = () => defHttp.post({ url: ALTIMETER + Api.ALT_CARD });
